<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8"/>

    <title>{:Config('store_name')}</title>

    <meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge"/>

    <meta name="renderer" content="webkit|ie-comp|ie-stand">

    <meta name="robots" content="noindex,nofollow">

    <!-- HTML5 shim for IE8 support of HTML5 elements -->

    <!--[if lt IE 9]>

    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>

    <![endif]-->

    <style>

        .input{

            margin:25px auto;

        }

        .div1{            

            width: 450px;

            height: 550px;

            margin-top:320px;

            margin-left: auto;

            margin-right: auto;

            }

        h3{

            font-size:30px;

            text-align:center; /*水平居中*/

        }

    </style>

    <link rel="stylesheet" href="__STATIC__/js/layui/css/layui.css">

    <script>

        if (window.parent !== window.self) {

            document.write              = '';

            window.parent.location.href = window.self.location.href;

            setTimeout(function () {

                document.body.innerHTML = '';

            }, 0);

        }

    </script>

</head>

<body style="background-color: #F7FBFF;background-image:url('../../../static/images/bc.jpg');background-repeat:no-repeat;" >

<div class="wrap">

    <div class="container">

        <div class="row ">

            <div class="col-md-5 div1">

                 <h3 class="text-center" style="color:white;">{:Config('store_name')}</h3>     

                <form  class="layui-form layui-form-pane input"  action="{:url('public/doLogin_member')}" method="post">

                    <div class="layui-form-item ">

                        <div style="position: relative;" >

                        <input type="text" name="username" lay-verify="name" lay-reqtext="请输入登录账号" placeholder="请输入登录账号" autocomplete="off" class="layui-input">

                        </div>

                    </div>



                    <div class="layui-form-item ">

                        <div style="position: relative;" >

                        <input type="password" name="password" lay-verify="password" lay-reqtext="请输入登录密码" placeholder="请输入登录密码" autocomplete="off" class="layui-input">

                        </div>

                    </div>

                    

                    <div class="layui-form-item">

                        <div style="position: relative;" >

                            <input type="text" name="captcha" placeholder="验证码" lay-verify="captcha" lay-reqtext="请输入验证码"  class="form-control layui-input captcha">

                            <captcha height="36" width="150" font-size="18" style="cursor: pointer;position:absolute;right:1px;top:1px;"/>

                        </div>

                    </div>



                    <div class=" layui-form-item ">

                        <div style="position: relative;" >

                            <input type="hidden" name="redirect" value="">

                            <button type="submit" class="layui-btn layui-btn-fluid layui-btn-normal" lay-submit="" lay-filter="login">立即提交</button>

                        </div>

                    </div>



                </form>





            </div>

        </div>



    </div>

</div>



<script src="__TMPL__/public/assets/js/jquery-1.10.2.min.js"></script>

<script src="__STATIC__/js/layui/layui.all.js"></script>

<script>

;!function(){

    var form = layui.form

        ,layer = layui.layer    //弹出层必需

        //自定义验证规则

        form.verify({

            name:function(value){

                if( value.length == 0 ){ return '请输入登录账号'; }

            },

            password: [

                /^[\S]{6,16}$/

                ,'密码必须6到16位，且不能出现空格'

            ],

            captcha:function(value){

                if( value.length == 0 ){ return '请输入验证码'; }

            }

        });



        // 通用表单提交

        form.on('submit(login)', function(data){

            var type = $(data.form).attr('method') == 'post' ? 'post' : 'get' ;

            var url = $(data.form).attr('action') == '' ? '#' : $(data.form).attr('action');

            var jump = $(data.form).attr('jump');

            var async = $(data.form).attr('async') != 'true' ? false : true ;

            if($(data.form).attr('console')){  //打印表单提交数据

                console.log('表单数据',data.field);

            }

            $.ajax({

                url:url,

                type:type,

                async:async,    //或true,是否同步

                data:data.field,

                timeout:5000,    //超时时间

                dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text

                success:function(res) {

                    if($(data.form).attr('console')){  //打印接口返回结果

                        console.log(res);

                    }

                    layer.msg(res.message ,{icon:(res.code == 200)? 1 : 2,time:2000},function () {

                        if(res.code == '200'){

                            if(res.url){

                                window.location=res.url;

                            }

                        }else{

                            $('.captcha-img').click();

                        }

                    });

                }

            })

            return false; //阻止自带表单提交

        });

    

}();

</script>

</body>

</html>

